#!/sbin/openrc-run

output_log="${output_log:-/dev/null}"
error_log="${error_log:-/var/log/promtail/error.log}"
configfile="${PROMTAIL_CONF:-/etc/loki/promtail-local-config.yaml}"

name="${name:-Promtail}"
command="/usr/bin/promtail"
command_args="-config.file=${configfile}
	${PROMTAIL_OPTS}"
command_user="${command_user:-root:root}"
command_background=yes
make_pidfile=yes
pidfile="/run/${RC_SVCNAME}.pid"
start_stop_daemon_args="${SSD_OPTS}
	-1 ${output_log} -2 ${error_log}"

depend() {
	need net
}

start_pre() {
	checkpath -d -m 0750 -o "${command_user}" "/var/log/promtail"
}

